package com.ruoyi.system.domain;

import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.json.JSONObject;

/**
 * 配置信息对象 sys_configuration
 * 
 * @author ruoyi
 * @date 2021-04-27
 */
public class SysConfiguration extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 编号 */
    @Excel(name = "编号")
    private String configurationId;

    /** rsi发送频率 */
    @Excel(name = "rsi发送频率")
    private Integer configurationSendFrequencyRsi;

    /** 地图发送频率 */
    @Excel(name = "地图发送频率")
    private Integer configurationSendFrequencyMap;

    /** spat发送频率 */
    @Excel(name = "spat发送频率")
    private Integer configurationSendFrequencySpat;

    /** 消息可用性(0可用,1不可用) */
    @Excel(name = "消息可用性(0可用,1不可用)")
    private Integer configurationMessageenable;

    /** 心跳url */
    private String configurationHeartbeatUrl;

    /** 状态上报url */
    private String configurationStatusreportUrl;

    /** 参数刷新url */
    private String configurationConfigrefreshUrl;

    /** ota请求url */
    private String configurationOtarequestUrl;

    /** rsi升级需求 */
    @Excel(name = "rsi升级需求")
    private Integer configurationRsineedupdate;

    /** rsi升级url */
    private String configurationRsiupdateurl;

    /** spat升级需求 */
    @Excel(name = "spat升级需求")
    private Integer configurationSpatneedupdate;

    /** spat升级url */
    private String configurationSpatupdateurl;

    /** 地图升级需求 */
    @Excel(name = "地图升级需求")
    private Integer configurationMapneedupdate;

    /** 地图升级url */
    private String configurationMapupdateurl;

    public void setConfigurationId(String configurationId) 
    {
        this.configurationId = configurationId;
    }

    public String getConfigurationId() 
    {
        return configurationId;
    }
    public void setConfigurationSendFrequencyRsi(Integer configurationSendFrequencyRsi) 
    {
        this.configurationSendFrequencyRsi = configurationSendFrequencyRsi;
    }

    public Integer getConfigurationSendFrequencyRsi() 
    {
        return configurationSendFrequencyRsi;
    }
    public void setConfigurationSendFrequencyMap(Integer configurationSendFrequencyMap) 
    {
        this.configurationSendFrequencyMap = configurationSendFrequencyMap;
    }

    public Integer getConfigurationSendFrequencyMap() 
    {
        return configurationSendFrequencyMap;
    }
    public void setConfigurationSendFrequencySpat(Integer configurationSendFrequencySpat) 
    {
        this.configurationSendFrequencySpat = configurationSendFrequencySpat;
    }

    public Integer getConfigurationSendFrequencySpat() 
    {
        return configurationSendFrequencySpat;
    }
    public void setConfigurationMessageenable(Integer configurationMessageenable) 
    {
        this.configurationMessageenable = configurationMessageenable;
    }

    public Integer getConfigurationMessageenable() 
    {
        return configurationMessageenable;
    }
    public void setConfigurationHeartbeatUrl(String configurationHeartbeatUrl) 
    {
        this.configurationHeartbeatUrl = configurationHeartbeatUrl;
    }

    public String getConfigurationHeartbeatUrl() 
    {
        return configurationHeartbeatUrl;
    }
    public void setConfigurationStatusreportUrl(String configurationStatusreportUrl) 
    {
        this.configurationStatusreportUrl = configurationStatusreportUrl;
    }

    public String getConfigurationStatusreportUrl() 
    {
        return configurationStatusreportUrl;
    }
    public void setConfigurationConfigrefreshUrl(String configurationConfigrefreshUrl) 
    {
        this.configurationConfigrefreshUrl = configurationConfigrefreshUrl;
    }

    public String getConfigurationConfigrefreshUrl() 
    {
        return configurationConfigrefreshUrl;
    }
    public void setConfigurationOtarequestUrl(String configurationOtarequestUrl) 
    {
        this.configurationOtarequestUrl = configurationOtarequestUrl;
    }

    public String getConfigurationOtarequestUrl() 
    {
        return configurationOtarequestUrl;
    }
    public void setConfigurationRsineedupdate(Integer configurationRsineedupdate) 
    {
        this.configurationRsineedupdate = configurationRsineedupdate;
    }

    public Integer getConfigurationRsineedupdate() 
    {
        return configurationRsineedupdate;
    }
    public void setConfigurationRsiupdateurl(String configurationRsiupdateurl) 
    {
        this.configurationRsiupdateurl = configurationRsiupdateurl;
    }

    public String getConfigurationRsiupdateurl() 
    {
        return configurationRsiupdateurl;
    }
    public void setConfigurationSpatneedupdate(Integer configurationSpatneedupdate) 
    {
        this.configurationSpatneedupdate = configurationSpatneedupdate;
    }

    public Integer getConfigurationSpatneedupdate() 
    {
        return configurationSpatneedupdate;
    }
    public void setConfigurationSpatupdateurl(String configurationSpatupdateurl) 
    {
        this.configurationSpatupdateurl = configurationSpatupdateurl;
    }

    public String getConfigurationSpatupdateurl() 
    {
        return configurationSpatupdateurl;
    }
    public void setConfigurationMapneedupdate(Integer configurationMapneedupdate) 
    {
        this.configurationMapneedupdate = configurationMapneedupdate;
    }

    public Integer getConfigurationMapneedupdate() 
    {
        return configurationMapneedupdate;
    }
    public void setConfigurationMapupdateurl(String configurationMapupdateurl) 
    {
        this.configurationMapupdateurl = configurationMapupdateurl;
    }

    public String getConfigurationMapupdateurl() 
    {
        return configurationMapupdateurl;
    }


    @Override
    public String toString() {
        return "SysConfiguration{" +
                "configurationId='" + configurationId + '\'' +
                ", configurationSendFrequencyRsi=" + configurationSendFrequencyRsi +
                ", configurationSendFrequencyMap=" + configurationSendFrequencyMap +
                ", configurationSendFrequencySpat=" + configurationSendFrequencySpat +
                ", configurationMessageenable=" + configurationMessageenable +
                ", configurationHeartbeatUrl='" + configurationHeartbeatUrl + '\'' +
                ", configurationStatusreportUrl='" + configurationStatusreportUrl + '\'' +
                ", configurationConfigrefreshUrl='" + configurationConfigrefreshUrl + '\'' +
                ", configurationOtarequestUrl='" + configurationOtarequestUrl + '\'' +
                ", configurationRsineedupdate=" + configurationRsineedupdate +
                ", configurationRsiupdateurl='" + configurationRsiupdateurl + '\'' +
                ", configurationSpatneedupdate=" + configurationSpatneedupdate +
                ", configurationSpatupdateurl='" + configurationSpatupdateurl + '\'' +
                ", configurationMapneedupdate=" + configurationMapneedupdate +
                ", configurationMapupdateurl='" + configurationMapupdateurl + '\'' +
                '}';
    }

    public String toResponse() {

        JSONObject newConfig =new JSONObject();
        newConfig .put("send_frequency_rsi",configurationSendFrequencyRsi);
        newConfig .put("send_frequency_map",configurationSendFrequencyMap);
        newConfig .put("send_frequency_spat",configurationSendFrequencySpat);
        newConfig .put("messageEnable",configurationMessageenable);
        newConfig .put("heartbeat_url",configurationHeartbeatUrl);
        newConfig .put("statusReport_url",configurationStatusreportUrl);
        newConfig .put("configRefresh_url",configurationConfigrefreshUrl);
        newConfig .put("otaRequest_url",configurationOtarequestUrl);
        newConfig .put("rsiNeedUpdate",configurationRsineedupdate);
        newConfig .put("rsiUpdateUrl",configurationRsiupdateurl);
        newConfig .put("spatNeedUpdate",configurationSpatneedupdate);
        newConfig .put("spatUpdateUrl",configurationSpatupdateurl);
        newConfig .put("mapNeedUpdate",configurationMapneedupdate);
        newConfig .put("mapUpdateUrl",configurationMapupdateurl);

        JSONObject configRefreshRet =new JSONObject();
        configRefreshRet.put("status_code",200);
        if(configurationMapneedupdate==1||configurationSpatneedupdate==1||configurationRsineedupdate==1) {
            configRefreshRet.put("need_refresh",1);
        } else {
            configRefreshRet.put("need_refresh",0);
        }

        configRefreshRet.put("config",newConfig);

        return configRefreshRet.toString();
    }
}
